﻿<%@ Import Namespace="AspNetMvc.Entities" %>
<%@ Import Namespace="AspNetMvc.Models" %>
<p>
    <label for="title">
        <%= ViewStrings.EventsStrings.Title %>:
    </label>
    <%= Html.TextBox("title", Model.Event.Title, new { @class="fo3", size = "20", maxlength="100" })%>
    <b>*</b>
</p>
<ul id="titleErrors" class="error3">
</ul>
<p>
    <label for="description">
        <%= ViewStrings.EventsStrings.Description %>:
    </label>
    <%= Html.TextArea("description", Model.Event.Description, new { cols = "25", rows = "5" })%>
    <b>*</b>
</p>
<ul id="descriptionErrors" class="error3">
</ul>
<p>
    <label for="eventType">
        <%= ViewStrings.EventsStrings.EventType %>:
    </label>
    <%= Html.DropDownList("typeSelect", Model.EventTypesList, new { onchange="getTypeProperties('typeSelect', 'typeProperties')" }) %>
    <span>
        <div id="typeProperties">
            <% if (Model.ViewType == EventViewType.Edit)
                   Html.RenderPartial("EventsMarkup/DynamicProperties/EditableDynamicProperties", new ViewPropertiesSet(Model.ViewType,
                           Model.TypePropertiesForView)); %>
        </div>
    </span>
</p>
<p>
    <label for="eventCategory">
        <%= ViewStrings.EventsStrings.EventCategories %>
    </label>
    <%
        var i = 0;
        string firstCategorySpanId = null;
        string firstCategorySelectId = null;
        foreach (var eventCategoriesList in Model.EventCategoriesLists)
        {
    %>
    <span <% if (i == 0)
                {
                   firstCategorySpanId = String.Format("categorySpan_{0}", i);
                   firstCategorySelectId = String.Format("categorySelect_{0}", i);
                   %> id="<%= firstCategorySpanId %>" <%
                }
                %> style="display: block">
        <%
var categorySelectId = String.Format("categorySelect_{0}", i); %>
        <%=Html.DropDownList(categorySelectId, eventCategoriesList, new { onchange="getCategoryProperties(this)" })%>
        <input type="button" value="+" onclick="AddCategory('<%= firstCategorySpanId %>', '<%= firstCategorySelectId %>')" />
        <div>
            <% if (Model.ViewType == EventViewType.Edit)
                   Html.RenderPartial("EventsMarkup/DynamicProperties/EditableDynamicProperties", new ViewPropertiesSet(Model.ViewType,
                           Model.CategoriesPropertiesForView[Model.Event.Categories[i]])); %>
        </div>
    </span>
<%
i++;
    }
%>
</p>
<p>
    <label>
        <%= ViewStrings.EventsStrings.StartDateTime %>
        (<%= ViewStrings.EventsStrings.LocalTime %>):
    </label>
    <%
        string startDateString = Model.StartDateString;
        if (Model.ViewType == EventViewType.Create)
            startDateString = null; %>
    <%= Html.TextBox("startDate", startDateString, new { maxlength = "100" })%>
    <%= ViewStrings.EventsStrings.AtTime %>
    <%= Html.DropDownList("startHours", Model.StartHoursList) %>
    :
    <%= Html.DropDownList("startMinutes", Model.StartMinutesList)%>
    <b>*</b>
</p>
<ul id="startDateTimeErrors" class="error3">
</ul>
<p>
    <label>
        <%= ViewStrings.EventsStrings.EndDateTime %>
        (<%= ViewStrings.EventsStrings.LocalTime %>):
    </label>
    <%= Html.TextBox("endDate", Model.EndDateString, new { maxlength = "100" })%>
    <%= ViewStrings.EventsStrings.AtTime %>
    <%= Html.DropDownList("endHours", Model.EndHoursList)%>
    :
    <%= Html.DropDownList("endMinutes", Model.EndMinutesList)%>
</p>
<ul id="endDateTimeErrors" class="error2">
</ul>
<%= Html.Hidden("cityUri", Model.Event.CityUri)%>
<%= Html.Hidden("placeUri", Model.Event.PlaceUri) %>
<p class="fo8">
    <label>
        <%= ViewStrings.EventsStrings.EventLocation %>:
    </label>
    <span id="eventLocationSpan">
        <% if (Model.Event.Id == 0)
           { %>
        <%= ViewStrings.EventsStrings.EventLocationIsNotChosen %>
        <% }
           else
           {
               Html.RenderPartial("EventDisplay/WhereView", Model.Event);
           } %>
        <b>*</b> </span>
</p>
<p class="fo5">
    <span id="locationPart1">
        <% if (Model.Event.Id == 0)
           { %>
        <%= ViewStrings.EventsStrings.LocationInitialPart1%>
        <% }
           else
           { %>
        <%= ViewStrings.EventsStrings.LocationAlreadySetPart1%>
        <% } 
        %>
    </span>
    <%= T4Extensions.ActionLink(Html, ViewStrings.EventsStrings.LocationPart2, MVC.Event.AddNewPlace(), new { @class="example5"} ) %>
    <%= ViewStrings.EventsStrings.LocationPart3 %>
    <%= T4Extensions.ActionLink(Html, ViewStrings.EventsStrings.LocationPart4, MVC.Event.AddLabeledPlace(), new { @class="example5"}) %>
    <%= ViewStrings.EventsStrings.LocationPart5 %>
</p>
<ul id="locationErrors" class="error3">
</ul>
<p class="sob">
    <b>*</b>
    <%= ViewStrings.EventsStrings.RequiredField %></p>
<ul id="generalErrors" class="error1">
</ul>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<EventForEditing>" %>

